﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Common;
using System.Data.OracleClient;
using System.Data.SqlClient;
using MySQLDriverCS;

namespace 工厂模式
{
    public class ConnectionFactory
    {
        public static DbConnection Create(string strType)
        {
            if (strType == "sql server")
            {
                return new SqlConnection();
            }
            else if (strType == "mysql")
            {
                return new MySQLConnection();
            }
            else if (strType == "oracle")
            {
                return new OracleConnection();
            }
            else
            {
                return null;
            }
        }
    }
}
